home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / c / moush101.zip / MOUSE.HPP < prev    next >
C/C++ Source or Header  |  1992-07-27  |  4KB  |  128 lines

  1. /*
  2.  
  3.  MYMOUSE.HPP
  4.  
  5.  Header file for Microsoft Mouse routines for Turbo C++
  6.  
  7.  Michael Chen    7/26/1992
  8.  
  9.  Do not create instance until after graphics mode
  10.  
  11. */
  12.  
  13.  
  14. #ifndef __MOUSE_HPP
  15. #define __MOUSE_HPP
  16.  
  17. /****************************************************************************
  18.  
  19.  Include files
  20.  
  21. ****************************************************************************/
  22.  
  23. extern "C" {
  24. #include "mouse.h"
  25. }
  26.  
  27.  
  28. /****************************************************************************
  29.  
  30.  Defines, bit masks and flags
  31.  
  32. ****************************************************************************/
  33.  
  34.  
  35. /****************************************************************************
  36.  
  37.  Classes, typedefs and related info
  38.  
  39. ****************************************************************************/
  40.  
  41. class Mouse
  42. {
  43. public:
  44.  
  45.   Mouse()            { StartMouse(); }
  46.   ~Mouse()            { EndMouse();    }
  47.  
  48.   int init()            { return InitMouseDriver(); }
  49.   int reset()            { return ResetMouse(); }
  50.   int disable_driver()        { return DisableMouseDriver(); }
  51.   int enable_driver()        { return EnableMouseDriver(); }
  52.  
  53.   void show()            { ShowMouseCursor(); }
  54.   void hide()            { HideMouseCursor(); }
  55.  
  56.   int status()            { return GetMouseStatus(); }
  57.  
  58.   int buttons()            { return NumberOfButtons; }
  59.   int present()            { return DriverPresent; }
  60.   int x()            { return MouseX; }
  61.   int y()            { return MouseY; }
  62.   int button()            { return MouseButton; }
  63.   int left()            { return (MouseButton & S_LEFT_BUTTON); }
  64.   int right()            { return (MouseButton & S_RIGHT_BUTTON); }
  65.   int middle()            { return (MouseButton & S_MIDDLE_BUTTON); }
  66.   int which()            { return WhichButton; }
  67.   int pressed()            { return MousePressed; }
  68.   int where_x()         { return MouseWhereX; }
  69.   int where_y()            { return MouseWhereY; }
  70.   int moved_x()            { return MouseMovedX; }
  71.   int moved_y()            { return MouseMovedY; }
  72.   MouseHandler last_handler()    { return LastMouseHandler; }
  73.   int x_speed()            { return MouseXSpeed; }
  74.   int y_speed()            { return MouseYSpeed; }
  75.   int double_threshold()    { return MouseDoubleThreshold; }
  76.  
  77.   void position(int x,int y)    { SetMousePosition(x,y); }
  78.  
  79.   int check_down(int b)        { return GetMouseDown(b); }
  80.   int check_up(int b)        { return GetMouseUp(b); }
  81.   int check_moved()        { return GetMouseMove(); }
  82.   void clear_button(int b)    { GetMouseDown(b); GetMouseUp(b); }
  83.   void clear_moved()        { GetMouseMove(); }
  84.   void clear_all()        { clear_button(LEFT_BUTTON);
  85.                   clear_button(RIGHT_BUTTON);
  86.                   clear_button(MIDDLE_BUTTON);
  87.                   clear_moved(); }
  88.   void xrange(int l,int h)    { SetMouseXRange(l,h); }
  89.   void yrange(int l,int h)    { SetMouseYRange(l,h); }
  90.   void update_region
  91.     (int x0, int y0,
  92.      int x1, int y1)        { SetUpdateRegion(x0,y0,x1,y1); }
  93.  
  94.   void cursor(MouseCursor mc)    { SetMouseCursor(mc); }
  95.   int large_cursor
  96.     (LargeMouseCursor c)    { return SetLargeMouseCursor(c); }
  97.  
  98.   void set_handler
  99.     (MouseHandler mh,int mask)    { SetMouseHandler(mh,mask); }
  100.   void exchange_handler
  101.     (MouseHandler mh,int mask)    { ExchangeMouseHandler(mh,mask); }
  102.  
  103.   int set_alt_handler
  104.     (MouseHandler mh,int mask)    { return SetAltMouseHandler(mh,mask); }
  105.   MouseHandler get_alt_handler
  106.     (int mask)            { return GetAltMouseHandler(mask); }
  107.  
  108.   void lightpen(int f)        { SetLightPenEmulation(f); }
  109.  
  110.   void mickey_ratio
  111.     (int xr, int yr)        { SetMickeyRatio(xr,yr); }
  112.  
  113.   int state_size()        { return GetDriverStateSize(); }
  114.   void far* get_state()        { return GetDriverState(); }
  115.   void set_state(void far* fp)    { SetDriverState(fp); }
  116.  
  117.   void set_sensitivity
  118.     (int xs, int ys, int dt)    { SetMouseSensitivity(xs,ys,dt); }
  119.   void get_sensitivity()    { GetMouseSensitivity(); }
  120.  
  121.   void set_page(int p)        { SetMouseDisplayPage(p); }
  122.   int page()            { return GetMouseDisplayPage(); }
  123.  
  124. };
  125.  
  126.  
  127. #endif
  128.